import { fetchApiWithGet, fetchApiWithPost } from '../utils/index'
import { FETCH_GOODS_DETAILS_SUCC, FETCH_GOODS_DETAILS_FAIL } from '../contants/good'

const publicUrl = 'http://fengke.net:8081/shop/';

export function fetchGoodDetails(goodsId) {
	var url = `${publicUrl}goodsDetail_display`;
	var argus = {
		goodsId: goodsId
	};
	return dispatch => {
		fetchApiWithPost(url, argus, dispatch, FETCH_GOODS_DETAILS_SUCC, FETCH_GOODS_DETAILS_FAIL)
	}
}


// export function fetchGoodsFromData(classId) {
// 	var url = `${publicUrl}goodsByClass_display?classId=${classId}&num=20`;
// 	return dispatch => {
// 		fetchApiWithGet(url, dispatch, FETCH_GOODS_FROM_SORT_SUCC, FETCH_GOODS_FROM_SORT_FAIL)
// 	}
// }